package com.codez.unionpay.springboot.mq;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Service;

import lombok.extern.slf4j.Slf4j;

/**
 * @author zhengdechao
 * @createTime : 2019-06-14
 *
 */

@Service
@Slf4j
public class Receive implements InitializingBean{

	
	@Override
	public void afterPropertiesSet() throws Exception {
		System.err.println(123);
	}

	@RabbitListener(queues = RabbitConfig.DIRECT_QUEUE)
	public void handleDirect(String msg) {
		log.info("direct12接收到消息 : {}",msg);
	}
//	@RabbitListener(queues = {"hello","hello_"})
	public void handleDirect2(String msg) {
		log.info("direct21接收到消息 : {}",msg);
	}
	
	@RabbitListener(queues = RabbitConfig.TOPIC_EMAIL_QUEUE)
	public void handleEmail(String msg) {
		log.info("收到邮件处理消息：{}", msg);
	}
	@RabbitListener(queues = RabbitConfig.TOPIC_LOG_QUEUE)
	public void handleLog(String msg) {
		log.info("收到日志处理消息：{}", msg);
	}
	@RabbitListener(queues = RabbitConfig.TOPIC_ALL_QUEUE)
	public void handleAll(String msg) {
		log.info("收到topic处理消息：{}", msg);
	}
	
	@RabbitListener(queues = RabbitConfig.FANOUT_QUEUE1)
	public void handleFanout1(String msg) {
		log.info("1口接收到广播消息：{}" ,msg);
	}
	@RabbitListener(queues = RabbitConfig.FANOUT_QUEUE2)
	public void handleFanout2(String msg) {
		log.info("2口接收到广播消息：{}" ,msg);
	}
}
